package reno.ribbon.ribbon.timecycle;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

@Service
public class TimeCycleService {

    @Autowired
    RestTemplate restTemplate;

//    @HystrixCommand(fallbackMethod = "getError")
    public String getCetusCycle(){
        return restTemplate.getForObject("http://timecycle/getCetusCycle", String.class);
    }

//    @HystrixCommand(fallbackMethod = "getError")
    public String getEarthCycle(){
        return restTemplate.getForObject("http://timecycle/getEarthCycle", String.class);
    }

//    @HystrixCommand(fallbackMethod = "getError")
    public String getVallisCycle(){
        return restTemplate.getForObject("http://timecycle/getVallisCycle", String.class);
    }

    public String getError() {
        return "Sorry,Service invocation failed.";
    }
}
